#include<iostream>
using namespace std;
int main()
{
	int n1=0,n2=0,n3=0,n4=0,sum1=0,sum2=0,sum3=0,sum4=0;
	cin>>n1;
	n4=n3=n2=n1;
	for(;n1;n1=n1/10)
	{
		sum1=sum1+n1%10;
		
	}
	do{
		sum2=sum2+n2%10;
		n2=n2/10;
	}while(n2);
	while(n3)
	{
		sum3=sum3+n3%10;
		n3=n3/10;
	}
	while(1)
	{
		sum4=sum4+n4%10;
		n4=n4/10;
		if(n4==0)
		break;
	}
cout<<sum1<<sum2<<sum3<<sum4<<endl; 
	return 0;
}
